package org.blogwu.learn.designpattern.chapter28;

import org.springframework.util.CollectionUtils;

import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;

/**
 * 工作类型二实现类
 * @author senfel
 * @version 1.0
 * @date 2022/8/17 10:47
 */
public class DataFilterByTwo implements DataFilter{
    @Override
    public List<Users> actionData(List<Users> users) {
        if(CollectionUtils.isEmpty(users)){
            return new ArrayList<>();
        }
        return users.stream().filter(obj -> obj.getWorkType().equals(Users.WORK_TYPE_TWO)).collect(Collectors.toList());
    }
}
